package com.westa.smallshop.voiceprint;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.westa.smallshop.R;
import com.westa.smallshop.common.BaseFragment;

import butterknife.BindString;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Created by cy123 on 2016/9/13.
 */
public class VoiceRegisterFragment extends BaseFragment implements VoiceRegisterContract.View {

    @BindString(R.string.hint_title_login)
    String mTitle;
    @NonNull
    private VoiceRegisterContract.Presenter mPresenter;

    public VoiceRegisterFragment() {
        // Required empty public constructor
    }

    public static VoiceRegisterFragment newInstance() {

        return new VoiceRegisterFragment();
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void initView() {
        getActivity().setTitle(mTitle);
    }

    @Override
    public void onResume() {
        super.onResume();
        mPresenter.start();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        mPresenter.destroy();
    }

    @Override
    public int getCreateViewLayoutRes() {
        return R.layout.fragment_login;
    }

    @Override
    public boolean isActive() {
        return isAdded();
    }

    @Override
    public void setPresenter(@NonNull VoiceRegisterContract.Presenter presenter) {
        mPresenter = checkNotNull(presenter);
    }

}
